package com.example.ruomi.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;

/**
 * 存储系统中所有艺术家的信息
 * @TableName artists
 */
@TableName(value ="artists")
@Data
public class Artists {
    /**
     * 艺术家ID
     */
    @TableId(value = "artist_id", type = IdType.AUTO)
    private Integer artistId;

    /**
     * 艺术家姓名
     */
    @TableField(value = "name")
    private String name;

    /**
     * 艺术家简介
     */
    @TableField(value = "biography")
    private String biography;

    /**
     * 艺术家图片URL
     */
    @TableField(value = "image_url")
    private String imageUrl;

    /**
     * 艺术家音乐风格
     */
    @TableField(value = "genre")
    private String genre;

    /**
     * 艺术家国籍
     */
    @TableField(value = "country")
    private String country;

    /**
     * 出生日期
     */
    @TableField(value = "birth_date")
    private Date birthDate;

    /**
     * 去世日期（如果适用）
     */
    @TableField(value = "death_date")
    private Date deathDate;

    /**
     * 艺术家性别，适用于个人艺术家；乐团设为 not_applicable
     */
    @TableField(value = "gender")
    private Object gender;

    /**
     * 艺术家类型：个人或乐团
     */
    @TableField(value = "artist_type")
    private Object artistType;

    /**
     * 创建时间，默认当前时间
     */
    @TableField(value = "created_at")
    private Date createdAt;

    /**
     * 更新时间，默认当前时间并自动更新
     */
    @TableField(value = "updated_at")
    private Date updatedAt;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Artists other = (Artists) that;
        return (this.getArtistId() == null ? other.getArtistId() == null : this.getArtistId().equals(other.getArtistId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getBiography() == null ? other.getBiography() == null : this.getBiography().equals(other.getBiography()))
            && (this.getImageUrl() == null ? other.getImageUrl() == null : this.getImageUrl().equals(other.getImageUrl()))
            && (this.getGenre() == null ? other.getGenre() == null : this.getGenre().equals(other.getGenre()))
            && (this.getCountry() == null ? other.getCountry() == null : this.getCountry().equals(other.getCountry()))
            && (this.getBirthDate() == null ? other.getBirthDate() == null : this.getBirthDate().equals(other.getBirthDate()))
            && (this.getDeathDate() == null ? other.getDeathDate() == null : this.getDeathDate().equals(other.getDeathDate()))
            && (this.getGender() == null ? other.getGender() == null : this.getGender().equals(other.getGender()))
            && (this.getArtistType() == null ? other.getArtistType() == null : this.getArtistType().equals(other.getArtistType()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getArtistId() == null) ? 0 : getArtistId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getBiography() == null) ? 0 : getBiography().hashCode());
        result = prime * result + ((getImageUrl() == null) ? 0 : getImageUrl().hashCode());
        result = prime * result + ((getGenre() == null) ? 0 : getGenre().hashCode());
        result = prime * result + ((getCountry() == null) ? 0 : getCountry().hashCode());
        result = prime * result + ((getBirthDate() == null) ? 0 : getBirthDate().hashCode());
        result = prime * result + ((getDeathDate() == null) ? 0 : getDeathDate().hashCode());
        result = prime * result + ((getGender() == null) ? 0 : getGender().hashCode());
        result = prime * result + ((getArtistType() == null) ? 0 : getArtistType().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", artistId=").append(artistId);
        sb.append(", name=").append(name);
        sb.append(", biography=").append(biography);
        sb.append(", imageUrl=").append(imageUrl);
        sb.append(", genre=").append(genre);
        sb.append(", country=").append(country);
        sb.append(", birthDate=").append(birthDate);
        sb.append(", deathDate=").append(deathDate);
        sb.append(", gender=").append(gender);
        sb.append(", artistType=").append(artistType);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append("]");
        return sb.toString();
    }
}